
const age = 22
const color = "yellow"

const obj1 = {
  // age: age
  ["na" + "me"]: "张三",
  // color: "color",
  [color]: "color",
  age,
  active() {
  }
}

console.log(obj1)
// Object.keys(obj1).forEach((item) => {
//   console.log(obj1[item])
// })
// console.log(Object.values(obj1))
// console.log(Object.entries(obj1))

const parseQuery = () => {
  let str = `?cl=3&tn=baidutop10&fr=top1000&wd=美国通货膨胀率达30年来最高&rsv_idx=2&rsv_dl=fyb_n_homepage&hisfilter=1`
  let qArr = str.slice(1).split("&")
  qArr.forEach((item, index) => {
    qArr[index] = item.split("=")
  })
  return Object.fromEntries(qArr)
}

console.log(parseQuery())
console.log(parseQuery().wd)
console.log(parseQuery().cl)



/*
console.log(obj1)
// const obj2 = { obj1 }
// 对象浅拷贝
const obj2 = { ...obj1 }
console.log(obj2)
const arrObj = {...[1, 2, 99]}
console.log(arrObj)*/


let o1 = {
  a: 1
}
let o2 = {
  b: 2,
  a: 111
}
let o3 = {
  c: 99
}
// Object.assign(target, s1, s2)
// Object.assign(o1, o2, o3)
// console.log(o1)
// const newObj = Object.assign({}, o1, o2, o3)
// console.log(newObj)

/*
let newObj = {
  ...o2,
  ...o3,
  ...o1,
}
console.log(newObj)*/


